﻿using AJWPFAdmin.Core.Utils;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace AJWPFAdmin.Core.Converters
{
    public class ImagePreviewBtnInTableConverter : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var type = parameter?.ToString() ?? "text";
            var str = value as string;
            if (string.IsNullOrWhiteSpace(str) || str == "[]")
            {
                return type == "text" ? "暂无图片" : false;
            }
            return type == "text" ? "查看图片" : true;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
